package com.qfedu.bookstores.service.impl;

import com.qfedu.bookstores.dao.IBookDao;
import com.qfedu.bookstores.dao.impl.IBookDaoImpl;
import com.qfedu.bookstores.entity.Book;
import com.qfedu.bookstores.service.IBookService;

import java.util.List;

public class IBookServiceImpl implements IBookService {
    //提供一个操作Dao层的对象
    private IBookDao bookDao = new IBookDaoImpl();
    @Override
    public int addBook(Book book) {
        return bookDao.addBook(book);
    }

    @Override
    public int deleteBookById(Integer id) {
        return bookDao.deleteBookById(id);
    }

    @Override
    public int updateBook(Book book) {
        return bookDao.updateBook(book);
    }

    @Override
    public Book queryBookById(Integer id) {
        return  bookDao.queryBookById(id);
    }

    @Override
    public List<Book> queryBooks() {
        return bookDao.queryBooks();
    }
}
